import request from '../utils/request.js'
import apiConfig from '../config/api.js'

// 门票相关接口
export const ticketApi = {
	// 获取门票列表（支持分页）
	getTickets: (params = {}) => {
		return request({
			url: apiConfig.apiList.getTickets,
			method: 'GET',
			data: params  // 修改这里，使用data而不是params
		})
	},
	
	// 添加门票
	addTicket: (data) => {
		return request({
			url: apiConfig.apiList.addTicket,
			method: 'POST',
			data: data
		})
	},
	
	// 删除门票
	deleteTicket: (ticketId) => {
		return request({
			url: `${apiConfig.apiList.deleteTicket}/${ticketId}`,
			method: 'DELETE'
		})
	},
	
	// 更新门票
	updateTicket: (ticketId, data) => {
		return request({
			url: `${apiConfig.apiList.updateTicket}/${ticketId}`,
			method: 'PUT',
			data: data
		})
	},
	
	// 获取推荐门票
	getRecommendedTickets: () => {
		return request({
			url: apiConfig.apiList.getRecommendedTickets,
			method: 'GET'
		})
	}
}

export default ticketApi